//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CVertexLayout10.h>
///	@path	~/src/graphics/dx10/
///	@date	2008/12/28
///	@desc	.

#pragma once

#include "xeres.h"

#include "graphics/IVertexLayout.h"
#include "graphics/dx10/CDevice10.h"
#include "graphics/common/CSlotLayout.h"

namespace xeres {

	/*! 
		\class	CVertexLayout10
		\brief
	*/
	class CVertexLayout10: public IVertexLayout
	{
	public:

		/// \ctor
		CVertexLayout10( RefWeak<IShaderAdapter> defaultAdapter ,
			std::vector<D3D10_INPUT_ELEMENT_DESC>& desc , const std::vector< Ref<CSlotLayout> >& slots );

		/// \dtor
		virtual ~CVertexLayout10( void );

		DECL_IOBJECT_CLASS( CVertexLayout10 , IVertexLayout );

	public:

		//@ interface

		/*! 
			\brief		Apply vertex layout.
		*/
		virtual void ApplyLayout( RenderContext& rc );

		/*!
			\brief		Get used slot count.
		*/
		virtual size_t GetSlotCount( void );

		/*! 
			\brief		Get slot layout.
		*/
		virtual RefWeak<ISlotLayout> GetSlot( size_t slot );

		/*! 
			\brief		Get default shader adapter.
		*/
		virtual RefWeak<IShaderAdapter> GetDefaultAdapter( void );

		/*! 
			\brief		Get declaration.
		*/
		const std::vector<D3D10_INPUT_ELEMENT_DESC>& GetInputDesc( void ) const { return m_desc; }

	private:

		//@ data
		Ref<IShaderAdapter>						m_defaultAdapter;
		std::vector<D3D10_INPUT_ELEMENT_DESC>	m_desc;
		std::vector< Ref<CSlotLayout> >			m_slots;
	};
	
} // namespace xeres
